/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pckLibro;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author miriam
 */
@Entity
@Table(name = "libro")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Libro.findAll", query = "SELECT l FROM Libro l"),
    @NamedQuery(name = "Libro.findById", query = "SELECT l FROM Libro l WHERE l.id = :id"),
    @NamedQuery(name = "Libro.findByNombre", query = "SELECT l FROM Libro l WHERE l.nombre = :nombre"),
    @NamedQuery(name = "Libro.findByAnio", query = "SELECT l FROM Libro l WHERE l.anio = :anio"),
    @NamedQuery(name = "Libro.findByCurso", query = "SELECT l FROM Libro l WHERE l.curso = :curso"),
    @NamedQuery(name = "Libro.findByBueno", query = "SELECT l FROM Libro l WHERE l.bueno = :bueno"),
    @NamedQuery(name = "Libro.findByMalo", query = "SELECT l FROM Libro l WHERE l.malo = :malo"),
    @NamedQuery(name = "Libro.findByRegular", query = "SELECT l FROM Libro l WHERE l.regular = :regular"),
    @NamedQuery(name = "Libro.findByProfesor", query = "SELECT l FROM Libro l WHERE l.profesor = :profesor"),
    @NamedQuery(name = "Libro.findByCorreo", query = "SELECT l FROM Libro l WHERE l.correo = :correo")})
public class Libro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nombre")
    private String nombre;
    @Column(name = "anio")
    private Integer anio;
    @Size(max = 50)
    @Column(name = "curso")
    private String curso;
    @Column(name = "bueno")
    private Boolean bueno;
    @Column(name = "malo")
    private Boolean malo;
    @Column(name = "regular")
    private Boolean regular;
    @Size(max = 30)
    @Column(name = "profesor")
    private String profesor;
    @Size(max = 32)
    @Column(name = "correo")
    private String correo;

    public Libro() {
    }

    public Libro(Integer id) {
        this.id = id;
    }

    public Libro(Integer id, String nombre) {
        this.id = id;
        this.nombre = nombre;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Integer getAnio() {
        return anio;
    }

    public void setAnio(Integer anio) {
        this.anio = anio;
    }

    public String getCurso() {
        return curso;
    }

    public void setCurso(String curso) {
        this.curso = curso;
    }

    public Boolean getBueno() {
        return bueno;
    }

    public void setBueno(Boolean bueno) {
        this.bueno = bueno;
    }

    public Boolean getMalo() {
        return malo;
    }

    public void setMalo(Boolean malo) {
        this.malo = malo;
    }

    public Boolean getRegular() {
        return regular;
    }

    public void setRegular(Boolean regular) {
        this.regular = regular;
    }

    public String getProfesor() {
        return profesor;
    }

    public void setProfesor(String profesor) {
        this.profesor = profesor;
    }

    public String getCorreo() {
        return correo;
    }

    public void setCorreo(String correo) {
        this.correo = correo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Libro)) {
            return false;
        }
        Libro other = (Libro) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pckLibro.Libro[ id=" + id + " ]";
    }
    
}
